#include <cstdio>

const int N = 4e5;
int t, k, cnt, mul[N], pri[N];
bool vis[N];

inline bool check(int mid) {
  long long res = mid;
  for (int i = 2; i * i <= mid; ++i) { res += 1ll * mul[i] * (mid / (i * i)); }
  return res >= k;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("P4318 完全平方数.in", "r", stdin);
  freopen("P4318 完全平方数.out", "w", stdout);
#endif
#endif

  mul[1] = 1;
  for (int i = 2; i < N; ++i) {
    if (!vis[i]) { mul[i] = -1, pri[++cnt] = i; }
    for (int j = 1; j <= cnt && pri[j] * i < N; ++j) {
      vis[i * pri[j]] = true;
      if (i % pri[j] == 0) { break; }
      mul[i * pri[j]] = -mul[i];
    }
  }
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &k);
    int l = k, r = k << 1, mid;
    while (l < r) {
      mid = (0ll + l + r) >> 1;
      if (check(mid)) {
        r = mid;
      } else
        l = mid + 1;
    }
    printf("%d\n", r);
  }
  return 0;
}